package com.example.piece.ui.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.ViewDataBinding
import com.therouter.router.Route
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import com.example.base.ui.view.recyclerview.SpaceItemDecoration
import com.example.piece.R
import com.example.piece.constant.RoutePath
import com.example.piece.databinding.ActivityJuBaoBinding
import com.example.piece.entity.JuBaoEntity
import com.example.piece.ui.adapter.JuBaoAdapter
import com.example.piece.ui.adapter.LeDouAdapter

/**
 * 举报
 */

@Route(path = RoutePath.MAIN_JUBAO_ACTIVITY)
class JuBaoActivity : Layer3Activity<ActivityJuBaoBinding, ViewDataBinding>() {

    override val isTransparentStatusBar: Boolean = true
    override val isLockPortrait: Boolean = true
    override val statusBarAlpha: Int = 0
    override val isDarkMode: Boolean = true
    override val isFitsSystemWindows: Boolean = true
    override val leftIcon1Res: Int = R.drawable.ic_back
    override val centerLayoutRes: Int
        get() = R.layout.activity_ju_bao
    override val title: String
        get() = "举报"
    private val adapter: JuBaoAdapter by lazy {
        val adapter = JuBaoAdapter()
        mCenterViewBinding?.rv?.adapter = adapter
        adapter
    }

    override fun onClickLeftIcon1(view: View) {
        onBackPressed()

    }

    override fun initData(savedInstanceState: Bundle?) {
        super.initData(savedInstanceState)
        val data = listOf<JuBaoEntity>(
            JuBaoEntity("淫秽头像", false),
            JuBaoEntity("反动昵称", false),
            JuBaoEntity("人身工具", false),
            JuBaoEntity("消息骚扰", false),
            JuBaoEntity("泄露隐私", false),
            JuBaoEntity("垃圾营销", false))
        adapter.setList(data)
        mCenterViewBinding?.rv?.addItemDecoration(SpaceItemDecoration(10))
        adapter.setOnItemClickListener(object : OnItemClickListener {
            override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
                for (item in data) {
                    item.isSelect = false
                }
                data.get(position).isSelect = true
                adapter.notifyDataSetChanged()
            }

        })
    }
}